<template>
  当前登录用户为：{{ user }}
  <table border="1">
    <td>张三</td>
    <td>18</td>
    <td>男</td>
    <td>
        <button @click="onDetail">查看详情</button>
        <button @click="onDelete" v-if="user==='admin'" style="background-color: green;">if删除</button>
        <button @click="onDelete" v-show="user==='admin'" style="background-color: red;">show删除</button>
    </td>
  </table>
</template>

<script setup>
import { ref } from 'vue';
    const user = ref('stu')
    const onDelete = ()=> {
        console.log('删除成功了')
    }
    const onDetail = () => {
        console.log('查看详情')
    }
</script>

<style>

</style>